 /* Copyright 2018 JDCLOUD.COM

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http:#www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.





Contact: 

NOTE: This class is auto generated by the jdcloud code generator program.
*/


#import <Foundation/Foundation.h>
#import <JDCloudOCSDKMongodb/MongodbModel.h>

@implementation Backup
-(id) initWithBackupId:(NSString*) backupId
      backupName:(NSString*)backupName
      instanceId:(NSString*)instanceId
      backupStatus:(NSString*)backupStatus
      backupStartTime:(NSString*)backupStartTime
      backupEndTime:(NSString*)backupEndTime
      backupMode:(NSString*)backupMode
      backupSizeByte:(NSNumber*)backupSizeByte { 
     self.backupId = backupId;               
     self.backupName = backupName;               
     self.instanceId = instanceId;               
     self.backupStatus = backupStatus;               
     self.backupStartTime = backupStartTime;               
     self.backupEndTime = backupEndTime;               
     self.backupMode = backupMode;               
     self.backupSizeByte = backupSizeByte;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self backupId])
    {
        [result setValue:[self backupId] forKey:@"backupId"];
    }
    if([self backupName])
    {
        [result setValue:[self backupName] forKey:@"backupName"];
    }
    if([self instanceId])
    {
        [result setValue:[self instanceId] forKey:@"instanceId"];
    }
    if([self backupStatus])
    {
        [result setValue:[self backupStatus] forKey:@"backupStatus"];
    }
    if([self backupStartTime])
    {
        [result setValue:[self backupStartTime] forKey:@"backupStartTime"];
    }
    if([self backupEndTime])
    {
        [result setValue:[self backupEndTime] forKey:@"backupEndTime"];
    }
    if([self backupMode])
    {
        [result setValue:[self backupMode] forKey:@"backupMode"];
    }
    if([self backupSizeByte])
    {
        [result setValue:[self backupSizeByte] forKey:@"backupSizeByte"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.backupId = [dictionary objectForKey:@"backupId"];
    self.backupName = [dictionary objectForKey:@"backupName"];
    self.instanceId = [dictionary objectForKey:@"instanceId"];
    self.backupStatus = [dictionary objectForKey:@"backupStatus"];
    self.backupStartTime = [dictionary objectForKey:@"backupStartTime"];
    self.backupEndTime = [dictionary objectForKey:@"backupEndTime"];
    self.backupMode = [dictionary objectForKey:@"backupMode"];
    self.backupSizeByte = [dictionary objectForKey:@"backupSizeByte"];
    return self;
}
 @end
@implementation MongodbQuota
-(id) initWithTotal:(NSNumber*) total
      use:(NSNumber*)use { 
     self.total = total;               
     self.use = use;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self total])
    {
        [result setValue:[self total] forKey:@"total"];
    }
    if([self use])
    {
        [result setValue:[self use] forKey:@"use"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.total = [dictionary objectForKey:@"total"];
    self.use = [dictionary objectForKey:@"use"];
    return self;
}
 @end
@implementation MongodbInfos
-(id) initWithSpaceId:(NSString*) spaceId
      status:(NSString*)status { 
     self.spaceId = spaceId;               
     self.status = status;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self spaceId])
    {
        [result setValue:[self spaceId] forKey:@"spaceId"];
    }
    if([self status])
    {
        [result setValue:[self status] forKey:@"status"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.spaceId = [dictionary objectForKey:@"spaceId"];
    self.status = [dictionary objectForKey:@"status"];
    return self;
}
 @end
@implementation DBInstanceSpec
-(id) initWithInstanceName:(NSString*) instanceName
      engine:(NSString*)engine
      engineVersion:(NSString*)engineVersion
      instanceClass:(NSString*)instanceClass
      instanceStorageGB:(NSNumber*)instanceStorageGB
      multiAZ:(NSNumber*)multiAZ
      azId:(NSArray<NSString*>*)azId
      vpcId:(NSString*)vpcId
      subnetId:(NSString*)subnetId
      password:(NSString*)password
      backupId:(NSString*)backupId
      originDBInstanceId:(NSString*)originDBInstanceId
      restoreTime:(NSString*)restoreTime { 
     self.instanceName = instanceName;               
     self.engine = engine;               
     self.engineVersion = engineVersion;               
     self.instanceClass = instanceClass;               
     self.instanceStorageGB = instanceStorageGB;               
     self.multiAZ = multiAZ;               
     self.azId = azId;               
     self.vpcId = vpcId;               
     self.subnetId = subnetId;               
     self.password = password;               
     self.backupId = backupId;               
     self.originDBInstanceId = originDBInstanceId;               
     self.restoreTime = restoreTime;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self instanceName])
    {
        [result setValue:[self instanceName] forKey:@"instanceName"];
    }
    if([self engine])
    {
        [result setValue:[self engine] forKey:@"engine"];
    }
    if([self engineVersion])
    {
        [result setValue:[self engineVersion] forKey:@"engineVersion"];
    }
    if([self instanceClass])
    {
        [result setValue:[self instanceClass] forKey:@"instanceClass"];
    }
    if([self instanceStorageGB])
    {
        [result setValue:[self instanceStorageGB] forKey:@"instanceStorageGB"];
    }
    if([self multiAZ])
    {
        [result setValue:[self multiAZ] forKey:@"multiAZ"];
    }
    if([self azId])
    {
        [result setValue:[self azId] forKey:@"azId"];
    }
    if([self vpcId])
    {
        [result setValue:[self vpcId] forKey:@"vpcId"];
    }
    if([self subnetId])
    {
        [result setValue:[self subnetId] forKey:@"subnetId"];
    }
    if([self password])
    {
        [result setValue:[self password] forKey:@"password"];
    }
    if([self backupId])
    {
        [result setValue:[self backupId] forKey:@"backupId"];
    }
    if([self originDBInstanceId])
    {
        [result setValue:[self originDBInstanceId] forKey:@"originDBInstanceId"];
    }
    if([self restoreTime])
    {
        [result setValue:[self restoreTime] forKey:@"restoreTime"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.instanceName = [dictionary objectForKey:@"instanceName"];
    self.engine = [dictionary objectForKey:@"engine"];
    self.engineVersion = [dictionary objectForKey:@"engineVersion"];
    self.instanceClass = [dictionary objectForKey:@"instanceClass"];
    self.instanceStorageGB = [dictionary objectForKey:@"instanceStorageGB"];
    self.multiAZ = [dictionary objectForKey:@"multiAZ"];
    self.azId = [dictionary objectForKey:@"azId"];
    self.vpcId = [dictionary objectForKey:@"vpcId"];
    self.subnetId = [dictionary objectForKey:@"subnetId"];
    self.password = [dictionary objectForKey:@"password"];
    self.backupId = [dictionary objectForKey:@"backupId"];
    self.originDBInstanceId = [dictionary objectForKey:@"originDBInstanceId"];
    self.restoreTime = [dictionary objectForKey:@"restoreTime"];
    return self;
}
 @end
@implementation BackupSynchronicity
-(id) initWithServiceId:(NSString*) serviceId
      instanceId:(NSString*)instanceId
      instanceName:(NSString*)instanceName
      serviceStatus:(NSString*)serviceStatus
      srcRegion:(NSString*)srcRegion
      dstRegion:(NSString*)dstRegion
      engine:(NSString*)engine
      engineVersion:(NSString*)engineVersion
      createTime:(NSString*)createTime
      mongodbNewestDataTime:(NSString*)mongodbNewestDataTime { 
     self.serviceId = serviceId;               
     self.instanceId = instanceId;               
     self.instanceName = instanceName;               
     self.serviceStatus = serviceStatus;               
     self.srcRegion = srcRegion;               
     self.dstRegion = dstRegion;               
     self.engine = engine;               
     self.engineVersion = engineVersion;               
     self.createTime = createTime;               
     self.mongodbNewestDataTime = mongodbNewestDataTime;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self serviceId])
    {
        [result setValue:[self serviceId] forKey:@"serviceId"];
    }
    if([self instanceId])
    {
        [result setValue:[self instanceId] forKey:@"instanceId"];
    }
    if([self instanceName])
    {
        [result setValue:[self instanceName] forKey:@"instanceName"];
    }
    if([self serviceStatus])
    {
        [result setValue:[self serviceStatus] forKey:@"serviceStatus"];
    }
    if([self srcRegion])
    {
        [result setValue:[self srcRegion] forKey:@"srcRegion"];
    }
    if([self dstRegion])
    {
        [result setValue:[self dstRegion] forKey:@"dstRegion"];
    }
    if([self engine])
    {
        [result setValue:[self engine] forKey:@"engine"];
    }
    if([self engineVersion])
    {
        [result setValue:[self engineVersion] forKey:@"engineVersion"];
    }
    if([self createTime])
    {
        [result setValue:[self createTime] forKey:@"createTime"];
    }
    if([self mongodbNewestDataTime])
    {
        [result setValue:[self mongodbNewestDataTime] forKey:@"newestDataTime"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.serviceId = [dictionary objectForKey:@"serviceId"];
    self.instanceId = [dictionary objectForKey:@"instanceId"];
    self.instanceName = [dictionary objectForKey:@"instanceName"];
    self.serviceStatus = [dictionary objectForKey:@"serviceStatus"];
    self.srcRegion = [dictionary objectForKey:@"srcRegion"];
    self.dstRegion = [dictionary objectForKey:@"dstRegion"];
    self.engine = [dictionary objectForKey:@"engine"];
    self.engineVersion = [dictionary objectForKey:@"engineVersion"];
    self.createTime = [dictionary objectForKey:@"createTime"];
    self.mongodbNewestDataTime = [dictionary objectForKey:@"newestDataTime"];
    return self;
}
 @end
@implementation Tag
-(id) initWithKey:(NSString*) key
      value:(NSString*)value { 
     self.key = key;               
     self.value = value;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self key])
    {
        [result setValue:[self key] forKey:@"key"];
    }
    if([self value])
    {
        [result setValue:[self value] forKey:@"value"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.key = [dictionary objectForKey:@"key"];
    self.value = [dictionary objectForKey:@"value"];
    return self;
}
 @end
@implementation AvailableZones
-(id) initWithAz:(NSString*) az
      canSale:(NSNumber*)canSale { 
     self.az = az;               
     self.canSale = canSale;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self az])
    {
        [result setValue:[self az] forKey:@"az"];
    }
    if([self canSale])
    {
        [result setValue:[self canSale] forKey:@"canSale"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.az = [dictionary objectForKey:@"az"];
    self.canSale = [dictionary objectForKey:@"canSale"];
    return self;
}
 @end
@implementation Flavor
-(id) initWithCpu:(NSNumber*) cpu
      memory:(NSNumber*)memory
      iops:(NSNumber*)iops
      maxLink:(NSNumber*)maxLink
      maxDisk:(NSNumber*)maxDisk
      minDisk:(NSNumber*)minDisk
      diskStep:(NSNumber*)diskStep { 
     self.cpu = cpu;               
     self.memory = memory;               
     self.iops = iops;               
     self.maxLink = maxLink;               
     self.maxDisk = maxDisk;               
     self.minDisk = minDisk;               
     self.diskStep = diskStep;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self cpu])
    {
        [result setValue:[self cpu] forKey:@"cpu"];
    }
    if([self memory])
    {
        [result setValue:[self memory] forKey:@"memory"];
    }
    if([self iops])
    {
        [result setValue:[self iops] forKey:@"iops"];
    }
    if([self maxLink])
    {
        [result setValue:[self maxLink] forKey:@"maxLink"];
    }
    if([self maxDisk])
    {
        [result setValue:[self maxDisk] forKey:@"maxDisk"];
    }
    if([self minDisk])
    {
        [result setValue:[self minDisk] forKey:@"minDisk"];
    }
    if([self diskStep])
    {
        [result setValue:[self diskStep] forKey:@"diskStep"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.cpu = [dictionary objectForKey:@"cpu"];
    self.memory = [dictionary objectForKey:@"memory"];
    self.iops = [dictionary objectForKey:@"iops"];
    self.maxLink = [dictionary objectForKey:@"maxLink"];
    self.maxDisk = [dictionary objectForKey:@"maxDisk"];
    self.minDisk = [dictionary objectForKey:@"minDisk"];
    self.diskStep = [dictionary objectForKey:@"diskStep"];
    return self;
}
 @end
@implementation SpaceId
-(id) initWithSpaceIdValue:(NSString*) spaceIdValue
      status:(NSString*)status { 
     self.spaceIdValue = spaceIdValue;               
     self.status = status;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self spaceIdValue])
    {
        [result setValue:[self spaceIdValue] forKey:@"spaceId"];
    }
    if([self status])
    {
        [result setValue:[self status] forKey:@"status"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.spaceIdValue = [dictionary objectForKey:@"spaceId"];
    self.status = [dictionary objectForKey:@"status"];
    return self;
}
 @end
@implementation TopologyPair
-(id) initWithDomain:(NSString*) domain
      ip:(NSString*)ip
      port:(NSString*)port { 
     self.domain = domain;               
     self.ip = ip;               
     self.port = port;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self domain])
    {
        [result setValue:[self domain] forKey:@"domain"];
    }
    if([self ip])
    {
        [result setValue:[self ip] forKey:@"ip"];
    }
    if([self port])
    {
        [result setValue:[self port] forKey:@"port"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.domain = [dictionary objectForKey:@"domain"];
    self.ip = [dictionary objectForKey:@"ip"];
    self.port = [dictionary objectForKey:@"port"];
    return self;
}
 @end
@implementation BackupDownloadURL
-(id) initWithBackupName:(NSString*) backupName
      backupInternetDownloadURL:(NSString*)backupInternetDownloadURL
      backupIntranetDownloadURL:(NSString*)backupIntranetDownloadURL
      linkExpiredTime:(NSString*)linkExpiredTime { 
     self.backupName = backupName;               
     self.backupInternetDownloadURL = backupInternetDownloadURL;               
     self.backupIntranetDownloadURL = backupIntranetDownloadURL;               
     self.linkExpiredTime = linkExpiredTime;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self backupName])
    {
        [result setValue:[self backupName] forKey:@"backupName"];
    }
    if([self backupInternetDownloadURL])
    {
        [result setValue:[self backupInternetDownloadURL] forKey:@"backupInternetDownloadURL"];
    }
    if([self backupIntranetDownloadURL])
    {
        [result setValue:[self backupIntranetDownloadURL] forKey:@"backupIntranetDownloadURL"];
    }
    if([self linkExpiredTime])
    {
        [result setValue:[self linkExpiredTime] forKey:@"linkExpiredTime"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.backupName = [dictionary objectForKey:@"backupName"];
    self.backupInternetDownloadURL = [dictionary objectForKey:@"backupInternetDownloadURL"];
    self.backupIntranetDownloadURL = [dictionary objectForKey:@"backupIntranetDownloadURL"];
    self.linkExpiredTime = [dictionary objectForKey:@"linkExpiredTime"];
    return self;
}
 @end
@implementation DBInstance
-(id) initWithInstanceId:(NSString*) instanceId
      instanceName:(NSString*)instanceName
      engine:(NSString*)engine
      engineVersion:(NSString*)engineVersion
      instanceClass:(NSString*)instanceClass
      instanceStorageGB:(NSNumber*)instanceStorageGB
      instanceCPU:(NSNumber*)instanceCPU
      instanceMemoryGB:(NSNumber*)instanceMemoryGB
      azId:(NSArray<NSString*>*)azId
      vpcId:(NSString*)vpcId
      subnetId:(NSString*)subnetId
      replicaSetName:(NSString*)replicaSetName
      instanceDomain:(NSString*)instanceDomain
      dBName:(NSString*)dBName
      accountName:(NSString*)accountName
      instancePort:(NSString*)instancePort
      instanceStatus:(NSString*)instanceStatus
      backupRetentionPeriod:(NSNumber*)backupRetentionPeriod
      createTime:(NSString*)createTime
      preferredBackupWindow:(NSString*)preferredBackupWindow
      preferredmaintenanceWindow:(NSString*)preferredmaintenanceWindow
      charge:(Charge*)charge
      isSetSecurityIps:(NSNumber*)isSetSecurityIps
      tags:(NSArray<Tag*>*)tags { 
     self.instanceId = instanceId;               
     self.instanceName = instanceName;               
     self.engine = engine;               
     self.engineVersion = engineVersion;               
     self.instanceClass = instanceClass;               
     self.instanceStorageGB = instanceStorageGB;               
     self.instanceCPU = instanceCPU;               
     self.instanceMemoryGB = instanceMemoryGB;               
     self.azId = azId;               
     self.vpcId = vpcId;               
     self.subnetId = subnetId;               
     self.replicaSetName = replicaSetName;               
     self.instanceDomain = instanceDomain;               
     self.dBName = dBName;               
     self.accountName = accountName;               
     self.instancePort = instancePort;               
     self.instanceStatus = instanceStatus;               
     self.backupRetentionPeriod = backupRetentionPeriod;               
     self.createTime = createTime;               
     self.preferredBackupWindow = preferredBackupWindow;               
     self.preferredmaintenanceWindow = preferredmaintenanceWindow;               
     self.charge = charge;               
     self.isSetSecurityIps = isSetSecurityIps;               
     self.tags = tags;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self instanceId])
    {
        [result setValue:[self instanceId] forKey:@"instanceId"];
    }
    if([self instanceName])
    {
        [result setValue:[self instanceName] forKey:@"instanceName"];
    }
    if([self engine])
    {
        [result setValue:[self engine] forKey:@"engine"];
    }
    if([self engineVersion])
    {
        [result setValue:[self engineVersion] forKey:@"engineVersion"];
    }
    if([self instanceClass])
    {
        [result setValue:[self instanceClass] forKey:@"instanceClass"];
    }
    if([self instanceStorageGB])
    {
        [result setValue:[self instanceStorageGB] forKey:@"instanceStorageGB"];
    }
    if([self instanceCPU])
    {
        [result setValue:[self instanceCPU] forKey:@"instanceCPU"];
    }
    if([self instanceMemoryGB])
    {
        [result setValue:[self instanceMemoryGB] forKey:@"instanceMemoryGB"];
    }
    if([self azId])
    {
        [result setValue:[self azId] forKey:@"azId"];
    }
    if([self vpcId])
    {
        [result setValue:[self vpcId] forKey:@"vpcId"];
    }
    if([self subnetId])
    {
        [result setValue:[self subnetId] forKey:@"subnetId"];
    }
    if([self replicaSetName])
    {
        [result setValue:[self replicaSetName] forKey:@"replicaSetName"];
    }
    if([self instanceDomain])
    {
        [result setValue:[self instanceDomain] forKey:@"instanceDomain"];
    }
    if([self dBName])
    {
        [result setValue:[self dBName] forKey:@"dBName"];
    }
    if([self accountName])
    {
        [result setValue:[self accountName] forKey:@"accountName"];
    }
    if([self instancePort])
    {
        [result setValue:[self instancePort] forKey:@"instancePort"];
    }
    if([self instanceStatus])
    {
        [result setValue:[self instanceStatus] forKey:@"instanceStatus"];
    }
    if([self backupRetentionPeriod])
    {
        [result setValue:[self backupRetentionPeriod] forKey:@"backupRetentionPeriod"];
    }
    if([self createTime])
    {
        [result setValue:[self createTime] forKey:@"createTime"];
    }
    if([self preferredBackupWindow])
    {
        [result setValue:[self preferredBackupWindow] forKey:@"preferredBackupWindow"];
    }
    if([self preferredmaintenanceWindow])
    {
        [result setValue:[self preferredmaintenanceWindow] forKey:@"preferredmaintenanceWindow"];
    }
    if([self charge])
    {
        [result setValue:[[self charge] dictionary]forKey:@"charge"];
    }
    if([self isSetSecurityIps])
    {
        [result setValue:[self isSetSecurityIps] forKey:@"isSetSecurityIps"];
    }
    if([self tags])
    {
        NSMutableArray<NSDictionary*>* arrayDic  = [[NSMutableArray alloc] init];
        for (int i =0 ; i< [[self tags] count]; i++) {
            Tag* item = [[self tags] objectAtIndex:i];
            [arrayDic addObject:[item dictionary]];
        }
        [result setValue:arrayDic forKey:@"tags"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.instanceId = [dictionary objectForKey:@"instanceId"];
    self.instanceName = [dictionary objectForKey:@"instanceName"];
    self.engine = [dictionary objectForKey:@"engine"];
    self.engineVersion = [dictionary objectForKey:@"engineVersion"];
    self.instanceClass = [dictionary objectForKey:@"instanceClass"];
    self.instanceStorageGB = [dictionary objectForKey:@"instanceStorageGB"];
    self.instanceCPU = [dictionary objectForKey:@"instanceCPU"];
    self.instanceMemoryGB = [dictionary objectForKey:@"instanceMemoryGB"];
    self.azId = [dictionary objectForKey:@"azId"];
    self.vpcId = [dictionary objectForKey:@"vpcId"];
    self.subnetId = [dictionary objectForKey:@"subnetId"];
    self.replicaSetName = [dictionary objectForKey:@"replicaSetName"];
    self.instanceDomain = [dictionary objectForKey:@"instanceDomain"];
    self.dBName = [dictionary objectForKey:@"dBName"];
    self.accountName = [dictionary objectForKey:@"accountName"];
    self.instancePort = [dictionary objectForKey:@"instancePort"];
    self.instanceStatus = [dictionary objectForKey:@"instanceStatus"];
    self.backupRetentionPeriod = [dictionary objectForKey:@"backupRetentionPeriod"];
    self.createTime = [dictionary objectForKey:@"createTime"];
    self.preferredBackupWindow = [dictionary objectForKey:@"preferredBackupWindow"];
    self.preferredmaintenanceWindow = [dictionary objectForKey:@"preferredmaintenanceWindow"];
    self.charge = [[Charge alloc]initWithDic:[dictionary objectForKey:@"charge"]];
    self.isSetSecurityIps = [dictionary objectForKey:@"isSetSecurityIps"];
    NSArray* tagsArray = [dictionary objectForKey:@"tags"];
    if(tagsArray&&![tagsArray isKindOfClass:[NSNull class]])
    {
        NSMutableArray* propertyArray = [[NSMutableArray alloc]init];
        for(int i = 0 ; i< [tagsArray count];i++)
        {
            Tag* item = [[Tag alloc]initWithDic:[tagsArray objectAtIndex:i]];
            if(item)
            {
                [propertyArray addObject:item];
            }
        }
        self.tags = propertyArray;
    }
    return self;
}
 @end
@implementation Topology
-(id) initWithPrimary:(TopologyPair*) primary
      secondary:(NSArray<TopologyPair*>*)secondary
      hidden:(NSArray<TopologyPair*>*)hidden { 
     self.primary = primary;               
     self.secondary = secondary;               
     self.hidden = hidden;               
    return self;
}

-(NSMutableDictionary*) dictionary{
    NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
    if([self primary])
    {
        [result setValue:[[self primary] dictionary]forKey:@"primary"];
    }
    if([self secondary])
    {
        NSMutableArray<NSDictionary*>* arrayDic  = [[NSMutableArray alloc] init];
        for (int i =0 ; i< [[self secondary] count]; i++) {
            TopologyPair* item = [[self secondary] objectAtIndex:i];
            [arrayDic addObject:[item dictionary]];
        }
        [result setValue:arrayDic forKey:@"secondary"];
    }
    if([self hidden])
    {
        NSMutableArray<NSDictionary*>* arrayDic  = [[NSMutableArray alloc] init];
        for (int i =0 ; i< [[self hidden] count]; i++) {
            TopologyPair* item = [[self hidden] objectAtIndex:i];
            [arrayDic addObject:[item dictionary]];
        }
        [result setValue:arrayDic forKey:@"hidden"];
    }
    return result;
}

-(id) initWithDic:(NSDictionary*)dictionary{
    self.primary = [[TopologyPair alloc]initWithDic:[dictionary objectForKey:@"primary"]];
    NSArray* secondaryArray = [dictionary objectForKey:@"secondary"];
    if(secondaryArray&&![secondaryArray isKindOfClass:[NSNull class]])
    {
        NSMutableArray* propertyArray = [[NSMutableArray alloc]init];
        for(int i = 0 ; i< [secondaryArray count];i++)
        {
            TopologyPair* item = [[TopologyPair alloc]initWithDic:[secondaryArray objectAtIndex:i]];
            if(item)
            {
                [propertyArray addObject:item];
            }
        }
        self.secondary = propertyArray;
    }
    NSArray* hiddenArray = [dictionary objectForKey:@"hidden"];
    if(hiddenArray&&![hiddenArray isKindOfClass:[NSNull class]])
    {
        NSMutableArray* propertyArray = [[NSMutableArray alloc]init];
        for(int i = 0 ; i< [hiddenArray count];i++)
        {
            TopologyPair* item = [[TopologyPair alloc]initWithDic:[hiddenArray objectAtIndex:i]];
            if(item)
            {
                [propertyArray addObject:item];
            }
        }
        self.hidden = propertyArray;
    }
    return self;
}
 @end
 
 


